<template>
  <div>
    <a-table :rowKey="rowKey" :rowSelection="rowSelection" :columns="columns" :dataSource="tableData">
      <template v-slot:bodyCell="{ column, record, index }">
        <template v-if="column.dataIndex === '操作'">
          <span v-for="item in column.btnArr" :key="item.label">
            <a-button
              v-if="typeof (item.activeIsShow) === 'function' ? item.activeIsShow({ column, record, index }) : item.activeIsShow"
              size="small" type="text" @click="item.onClick({ column, record, index })">
              {{ item.label }}
            </a-button>
          </span>
        </template>
      </template>
    </a-table>
  </div>
</template>
<script setup>
const props = defineProps({
  columns: {},
  tableData: [],
  rowKey: {
    type: String,
    define: 'id'
  }
})

const emit = defineEmits(['rowSelection'])

const rowSelection = {
  onChange: ((selectedRowKeys, selectedRows) => {
    emit('rowSelection', { selectedRowKeys, selectedRows })
  })
}
</script>
<style lang="">

</style>